#include "data_types.h"

const QString kResult("result");
const QString kCate("cate");
const QString kCnCate("cn_cate");
const QString kEnCate("en_cate");
const QString kSign("sign");
const QString kIconUrl("icon_url");

int parse_cate(QDomElement &e, cate &c) {
  QDomNodeList list = e.childNodes();
  for (int i = 0; i < list.count(); ++i) {
    QDomElement n = list.at(i).toElement();
    if (n.nodeName() == kCnCate) {
      c.cn_cate = n.text();
    }
    if (n.nodeName() == kEnCate) {
      c.en_cate = n.text();
    }
    if (n.nodeName() == kSign) {
      c.sign = n.text();
    }
    if (n.nodeName() == kIconUrl) {
      c.icon_url = n.text();
    }
  }

  return 0;
}

